package com.petshop.inventoryentries.service.impl;

import java.util.List;

import com.petshop.products.mapper.PetProductsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.petshop.inventoryentries.mapper.PetInventoryentriesMapper;
import com.petshop.inventoryentries.domain.PetInventoryentries;
import com.petshop.inventoryentries.service.IPetInventoryentriesService;

/**
 * 商品入库信息Service业务层处理
 *
 * @author ruoyi
 * @date 2024-09-11
 */
@Service
public class PetInventoryentriesServiceImpl implements IPetInventoryentriesService
{
    @Autowired
    private PetInventoryentriesMapper petInventoryentriesMapper;

    @Autowired
    private PetProductsMapper petProductsMapper;

    /**
     * 查询商品入库信息
     *
     * @param inventoryEntryID 商品入库信息主键
     * @return 商品入库信息
     */
    @Override
    public PetInventoryentries selectPetInventoryentriesByInventoryEntryID(Long inventoryEntryID)
    {
        return petInventoryentriesMapper.selectPetInventoryentriesByInventoryEntryID(inventoryEntryID);
    }

    /**
     * 查询商品入库信息列表
     *
     * @param petInventoryentries 商品入库信息
     * @return 商品入库信息
     */
    @Override
    public List<PetInventoryentries> selectPetInventoryentriesList(PetInventoryentries petInventoryentries)
    {
        return petInventoryentriesMapper.selectPetInventoryentriesList(petInventoryentries);
    }

    /**
     * 新增商品入库信息
     *
     * @param petInventoryentries 商品入库信息
     * @return 结果
     */
    @Override
    public int insertPetInventoryentries(PetInventoryentries petInventoryentries)
    {
        petProductsMapper.updatePetProductsByProductName(petInventoryentries);
        return petInventoryentriesMapper.insertPetInventoryentries(petInventoryentries);
    }

    /**
     * 修改商品入库信息
     *
     * @param petInventoryentries 商品入库信息
     * @return 结果
     */
    @Override
    public int updatePetInventoryentries(PetInventoryentries petInventoryentries)
    {
        return petInventoryentriesMapper.updatePetInventoryentries(petInventoryentries);
    }

    /**
     * 批量删除商品入库信息
     *
     * @param inventoryEntryIDs 需要删除的商品入库信息主键
     * @return 结果
     */
    @Override
    public int deletePetInventoryentriesByInventoryEntryIDs(Long[] inventoryEntryIDs)
    {
        return petInventoryentriesMapper.deletePetInventoryentriesByInventoryEntryIDs(inventoryEntryIDs);
    }

    /**
     * 删除商品入库信息信息
     *
     * @param inventoryEntryID 商品入库信息主键
     * @return 结果
     */
    @Override
    public int deletePetInventoryentriesByInventoryEntryID(Long inventoryEntryID)
    {
        return petInventoryentriesMapper.deletePetInventoryentriesByInventoryEntryID(inventoryEntryID);
    }
}
